package com.woniu.project.client;


import com.woniu.project.core.dto.ResultDto;
import com.woniu.project.params.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

/**
 * @Author: Klaus
 * @Date: 2020/9/28 19:05
 */
@FeignClient("management-service")
public interface ManagementClient {

    /**
     * 发送短信的服务
     * @param ManagementPhone 手机号码
     */
    @GetMapping("/pawn/management/sendMsg")
    ResultDto sendMsg(@PathVariable String ManagementPhone);

    /**
     * 管理员登录 判断账号密码是否正确 短信验证码是否正确
     * @return
     */
    @PostMapping("/pawn/management/login")
    ResultDto login(@Valid @RequestBody ManagementParams managementParams);

    /**
     * 新增管理员
     *
     * @param managementParams managementParams必须传入三个参数
     *                         managementName 用户名
     *                         managementPassword 密码
     *                         managementPhone 手机号
     * @return
     */
    @PostMapping("/pawn/management/addManagement")
    ResultDto addManagement(@RequestBody ManagementParams managementParams);

    /**
     * 查询所有管理员
     * page:页数 默认值 1
     * size:每页条数 默认值 10
     * @param selectParam
     * @return
     */
    @GetMapping("/pawn/management/selectAll")
    ResultDto selectAllManagement(@RequestBody SelectParam selectParam);

    /**
     * 修改管理员状态
     * @param managementParams
     *managementId 管理员ID
     *managementStatus 修改后的管理员的状态
     * @return
     */
    @PostMapping("/pawn/management/changeManagementStatus")
    ResultDto changeManagementStatus(@RequestBody ManagementParams managementParams);

    /**
     * 修改管理员的密码
     * @param managementParams
     * managementId 管理员ID
     * managementOldPassword  管理员旧密码
     * managementNewPassword  管理员新密码
     * @return
     */
    @PostMapping("/pawn/management/changeManagementPassword")
    ResultDto changeManagementPassword(@RequestBody ManagementChangePasswordParams managementParams);

    /**
     * 新增管理员的角色
     * @param roleParams
     * roleName 角色名
     * roleDescription 角色描述
     * @return
     */
    @PostMapping("/pawn/management/addRole")
    ResultDto addRole(@RequestBody RoleParams roleParams);

    /**
     * 给管理员分配角色
     * @return roleManagementParams
     * managementId 管理员ID
     * roleIdList 角色ID的集合
     */
    @PostMapping("/pawn/management/allocationRole")
    ResultDto allocationRole(@RequestBody RoleManagementParams roleManagementParams);

    /**
     * 查询所有管理员所有角色
     * @return
     */
    @GetMapping("/pawn/management/selectAllManagementRole")
    ResultDto selectAllManagementRole();

    /**
     * 查询指定管理员所有角色
     * @param managementId
     * @return
     */
    @GetMapping("/pawn/management/selectOneManagementRole")
    ResultDto selectOneManagementRole(@PathVariable String managementId);

    /**
     * 查询权限列表
     * @return
     */
    @GetMapping("/pawn/management/selectAllPermission")
    ResultDto selectAllPermission();

    /**
     * 根据角色ID修改角色的权限
     * @param rolePermissionParams
     * @return
     */
    @PostMapping("/pawn/management/changeRolePermission")
    ResultDto changeRolePermission(@RequestBody RolePermissionParams rolePermissionParams);

    /**
     * 测试fen
     */
    @GetMapping("/pawn/management/test")
    String test();
}
